<template>
  <div class="shop-user-body">
    <!-- header -->
    <shop-header>我的银行卡</shop-header>

    <!-- 列表 -->
    <div class="user-list">
      <ul>
        <li v-for="(item, key) in configList" @click="gotoDetail(item.id)">
          <div class="user-list-cell">
            {{ bankInfo[item.bankId] }} {{ item.bankUser }} {{ item.bankCard }}
          </div>
        </li>
      </ul>
    </div>
    <mt-button type="danger" size="large" style="position:fixed;bottom:0" @click="gotoDetail(0)">新增银行卡</mt-button>
  </div>
</template>

<script>
import {Cell} from 'mint-ui';
import Header from '../components/header';
import request from "../utils/request";
import { Indicator } from 'mint-ui';
import util from "../utils/util";

export default {
  components: {
    Cell,
    shopHeader: Header,
  },
  data() {
    return {
      bankInfo: {},
      configList: [],
    }
  },
  async created() {
    Indicator.open();
    this.bankInfo = await util.getFromCache("bankStr", "/ajax/member/bankInfo");
    const res = await request({}, "/ajax/member/configList");
    if(res && res.code == 0){
      this.configList = res.data;
    }
    Indicator.close();
  },
  methods: {
    gotoDetail(id) {
      this.$router.push({
        path: '/cashconfig-detail',
        query:{id: id}
      });
    }
  }
}

</script>

<style scoped>
p {
  margin: 0;
  padding: 0;
}

.shop-user-body {

}

/*列表*/
.user-list {
  background-color: #fff;
  margin-top: 0;
  margin-left: 10px;
  margin-right: 10px;
  font-size: 14px;
}

.user-list > ul {
  margin: 0;
  padding: 0;
  border-top: 1px solid #D9D9D9;
}

.user-list > ul > li {
  list-style: none;
  text-align: left;
  display: flex;
  justify-content: flex-end;
  padding-left: 20px;
  border-bottom: 1px solid #D9D9D9;
}

.user-list-cell {
  width: 100%;
  padding: 20px 0;
  position: relative;
  display: flex;
  align-items: center;
}

.user-list > ul > li:last-child > .user-list-cell {
  border: 0;
}

.user-list-cell > img {
  width: 20px;
  height: 20px;
  margin-right: 5px;
}

.user-list-cell:after {
  content: '';
  border: solid 2px #c8c8cd;
  border-bottom-width: 0;
  border-left-width: 0;
  width: 5px;
  height: 5px;
  position: absolute;
  right: 10px;
  top: 50%;
  -webkit-transform: translateY(-50%) rotate(45deg);
  transform: translateY(-50%) rotate(45deg);
}

</style>
